from django.db import models
from django.contrib.auth.models import AbstractUser


# Create your models here.

class UserProfile(AbstractUser):
    GENDER = (
        ('1', '男'),
        ('2', '女'),
        ('3', '鹿晗')
    )
    # +086
    mobile = models.CharField(max_length=14, verbose_name='手机号', help_text='手机号', blank=True, null=True, unique=True,
                              default=None)
    # 1男 2女 3
    gender = models.CharField(max_length=1, choices=GENDER, verbose_name='性别', help_text='用户性别', default='1')
    nick_name = models.CharField(max_length=40, verbose_name='昵称', help_text='昵称', blank=True)
    address = models.CharField(max_length=100, verbose_name='收货地址', help_text='收货地址')
    # auto_now 在你添加数据的时候给你默认添加当前日期,以后修改的时候是不会改变的, auto_now_add 在你修改的时候,自动给你更新时间
    register_time = models.DateTimeField(auto_now=True, verbose_name='用户注册时间', help_text='用户注册时间')

class CaptchaReg(models.Model):
    """
    用户注册验证码
    """

    captcha = models.CharField(max_length=6, verbose_name='验证码', help_text='验证码')
    email = models.EmailField(verbose_name='注册邮箱',help_text='注册邮箱')
    add_time = models.DateTimeField(auto_now=True, verbose_name='添加时间', help_text='添加时间')

    class Meta:
        verbose_name = '用户注册验证码'
        verbose_name_plural = '用户注册验证码'